package cate.game.pvp.eliterace.data;

import cate.common.table.d.GDEliteRace;
import cate.game.db.mongo.kv.KvMongo;
import cate.game.framework.advanced.AdvancedByteAttributes;
import cate.game.framework.advanced.AdvancedLongAttributes;
import cate.game.framework.advanced.AdvancedModuleKV;
import cate.game.pvp.eliterace.support.EliteRaceGMSupport;
import cate.game.pvp.eliterace.timer.EliteRaceTimerTask.Settings;
import easy.java.dev.note.NoteField;
import lombok.Data;
import lombok.ToString;

import java.util.List;

@ToString
@Data
public class EliteRaceKV extends AdvancedModuleKV {

    // 跳过本赛季
    public static final int OP_SKIP_SEASON = 1;

    private int season;

    private long cycleTimeMs;
    private int day;

    @NoteField(value = "阶段信息")
    private EliteRaceSpec spec;

    @NoteField(value = "事件对应阶段信息与触发时间")
    private List<Settings> timerSettings;

    @NoteField(value = "排行榜信息")
    private EliteRaceRankData rankData;

    @NoteField(value = "阵容信息")
    private EliteRacePsData psData;

    @NoteField(value = "战报")
    private EliteRaceRecordData recordData;

    @NoteField(value = "竞猜")
    private EliteRaceBetData betData;

    @NoteField(value = "当前处于什么事件阶段")
    private AdvancedLongAttributes eventAttributes;

    private AdvancedByteAttributes opAttributes;

    private EliteRaceGMSupport gmSupport;

    @Override
    public String getKeyPrefix() {
        return KvMongo.KEY_ELITE_RACE;
    }

    public long nextStartTime() {
        return (getSeason() % 2 == 1)
                ? getOpenTime() + GDEliteRace.WHOLE_SEASON_TIME
                : getOpenTime() + GDEliteRace.NEXT_WHOLE_SEASON_TIME;
    }
}
